﻿using System;
using System.ServiceModel;
using System.ServiceModel.Channels;

using SBPweb.RIA.Server.Common.Hosting;

namespace SBPweb.RIA.Server.Common.Communication
{

    public class BasicHttpHost : CustomHost
    {

        public BasicHttpHost(Type serviceType, Type contentType, string pathOfSvc)
            : base(serviceType, contentType, pathOfSvc)
        {
        }

        //protected override Binding CreateBindingInstanceForHttp(Type type, Uri address)
        //{
        //    return new BasicHttpBinding();
        //}

        protected override Binding CreateBindingInstance(Type type, SiteBinding binding, Uri address)
        {
            switch (binding.Protocol)
            {
                default:
                    return base.CreateBindingInstance(type, binding, address);
                case "http":
                    return new BasicHttpBinding();
            }
        }

    }

}
